UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ca+/aUGuLNQb8wOvbX5YAbnxg3f5oe2iU5HEF054WbY='
WHERE
key_id = '987ce1708f2759a43cda4d9bb167247f2bf836fee03f706eab075a409ee370a7'
AND (
token = 'ca+/aUGuLNQb8wOvbX5YAbnxg3f5oe2iU5HEF054WbY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)