UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qFsgk69PJ44s3l5SSSJPVYu8ku8Ro8ktKHwCRpbEh6Q='
WHERE
key_id = '9dae56a83bf120f69bd7e7944a2e46e4231e744de36a23eb74af31d6f1ff9c6e'
AND (
token = 'qFsgk69PJ44s3l5SSSJPVYu8ku8Ro8ktKHwCRpbEh6Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)