UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kITJrkgYSEjs1RB6TthP+HUC2CXb6h8fy6djH7tJnZE='
WHERE
key_id = 'a2bc817119eadd599f3f58a5507da24cfb3f8653213ea6882d11537c4776f9d3'
AND (
token = 'kITJrkgYSEjs1RB6TthP+HUC2CXb6h8fy6djH7tJnZE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)