UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nt4qNgjt2OC9SwrZqRx0GULBbOTfbNfhxpr5en59N8U=' 
WHERE 
  key_id = '5cecbb0335f48ee1f7eb90746f00d1c5bd3ba1c288f312c90cebf761cad95120' 
  AND (
    token = 'nt4qNgjt2OC9SwrZqRx0GULBbOTfbNfhxpr5en59N8U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025