UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NHr1Dgz4DSYCTBV81hwLitPYaJt9m4BS7RCtBEhCxe4=' 
WHERE 
  key_id = '1145910dde9fe0fd853e20e54e4b51e12b02690f211448c36030134b648d08e6' 
  AND (
    token = 'NHr1Dgz4DSYCTBV81hwLitPYaJt9m4BS7RCtBEhCxe4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028