UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UqMivsanfnmxOm1W+Qnne7QJJAJgoGSgChrG9jo25ts=' 
WHERE 
  key_id = '51efceba0592d94c1acc16488878c4660f76c19169c32ab854445e4c636ce335' 
  AND (
    token = 'UqMivsanfnmxOm1W+Qnne7QJJAJgoGSgChrG9jo25ts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048