UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KBhb0t56qOZHsQCL7oAjoJm9UYh+mGnMi5ISshX+khk='
WHERE
key_id = '6da99acea2bd538002ea127def890f1dd10a7dab8105abf444aeab0bd8bee9d2'
AND (
token = 'KBhb0t56qOZHsQCL7oAjoJm9UYh+mGnMi5ISshX+khk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)