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