UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u5H8svAuYz57F9JXa3fgLIxbDgGWMaQdqtEIpjIvjUU='
WHERE
key_id = 'ed229127fbee645b3d44309e95030d0c1672ea49a5f765b5fd6dd5444a4a5377'
AND (
token = 'u5H8svAuYz57F9JXa3fgLIxbDgGWMaQdqtEIpjIvjUU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)