UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's9ycwJf5OkAm+RVYNez4NspMEoonFE9Vid45p+npC5s=' 
WHERE 
  key_id = '1bef90521ac312042b320a0d31d81f2166e604db784a9d656d645c0a912d9724' 
  AND (
    token = 's9ycwJf5OkAm+RVYNez4NspMEoonFE9Vid45p+npC5s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017