UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MdyTChlJ9vUD1ouhT8Dlt7f7sKYR88POLTafxIqCf+0=' 
WHERE 
  key_id = '06c5aede4589346b2e8f556e2634ec477137f45695b31348923a10a70d143b8f' 
  AND (
    token = 'MdyTChlJ9vUD1ouhT8Dlt7f7sKYR88POLTafxIqCf+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042