UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DYE9EA7yB/XNFl7PgmqSCOBxa5Y6gzXG1lB2GJmaCrI=' 
WHERE 
  key_id = 'c87df95c81fb50205df80af1e5af0582818a322a9b107ff96e81178d201d74ed' 
  AND (
    token = 'DYE9EA7yB/XNFl7PgmqSCOBxa5Y6gzXG1lB2GJmaCrI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030