UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bY11Dz3QoueklXGoE7s0TgIVfZUowGU+tyj2IiX9/wY=' 
WHERE 
  key_id = '99d1de44f0502c6c86387e60cc7ae1223741933397b3978f93bed11ca374fb26' 
  AND (
    token = 'bY11Dz3QoueklXGoE7s0TgIVfZUowGU+tyj2IiX9/wY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027