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