UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '29rGD4c/s4pmk7qiYgOFrF4n1XkOumiQMeT1elkGzDc=' 
WHERE 
  key_id = 'c2d5343c12f2ad4e955347016833e6af5abd531be3ca833de53b20261c63c2d4' 
  AND (
    token = '29rGD4c/s4pmk7qiYgOFrF4n1XkOumiQMeT1elkGzDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052