UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NCyKB3LLRzG2tZCWTu82XvUenwH8gtKditnQ9O/M66g='
WHERE
key_id = 'fa9264d74ff15c7d3038de1417c05d40ce6018542d6abd16a0b3dfc92369227f'
AND (
token = 'NCyKB3LLRzG2tZCWTu82XvUenwH8gtKditnQ9O/M66g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)