UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '151TbNH6JGlVIVS4LdSkhddAoedDQkxVS5OPcLs54yc=' 
WHERE 
  key_id = 'f01c2f1fc46a533db71eb7952e46a2fb56dcc3fa9d4d3510feb3cc035c009582' 
  AND (
    token = '151TbNH6JGlVIVS4LdSkhddAoedDQkxVS5OPcLs54yc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051