UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GPTqtYWVI7B5YEjVE2oXYtMeyjrbU3ULcWvWHxOvsQs='
WHERE
key_id = '1417c4c9fad151e62d6e4f212e6255b417010637484a5d7977c5620b3ef4cda5'
AND (
token = 'GPTqtYWVI7B5YEjVE2oXYtMeyjrbU3ULcWvWHxOvsQs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)