UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cJHB2ACaZnsXEpiFSZcnkw+2mQoArfZKXyxTsETgT+I=' 
WHERE 
  key_id = '12e2660efe304c5cbb24b5eab8f130a24ffc8a8bcea11beda3912e569daaa65d' 
  AND (
    token = 'cJHB2ACaZnsXEpiFSZcnkw+2mQoArfZKXyxTsETgT+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023