UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P1oVcFxWwWZPhTxnVdF9k8j33TF/CEi7ToJOEQC+dpM=' 
WHERE 
  key_id = 'f110731050ebf88ddcf4b18e7b334ae24ef80cc721fcdbb996e25fbe2ab48045' 
  AND (
    token = 'P1oVcFxWwWZPhTxnVdF9k8j33TF/CEi7ToJOEQC+dpM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043