UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm2NKFlwgrILHJ6doPETHduAMX8HnV2s8N3jn8QCWH0A=' 
WHERE 
  key_id = 'ae247abe63366a8e2db90412f23121fa489da81bee05b7a010d9eaa7b0c4fe11' 
  AND (
    token = 'm2NKFlwgrILHJ6doPETHduAMX8HnV2s8N3jn8QCWH0A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045