UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aWftZgZKmh44y1NHPrC7IJKBkLSOMYGR2FZjOGilXao=' 
WHERE 
  key_id = 'c366e7076f2039c8da1e8f7273fee882913e08e296b8390cf90f46bf93863974' 
  AND (
    token = 'aWftZgZKmh44y1NHPrC7IJKBkLSOMYGR2FZjOGilXao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00114