UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P9m+IZ9rgviK2/OJimjZ7421tlJICcjlzmDMXdAwM1Q='
WHERE
key_id = 'c47ff4f930a80281aa14933566776b90d8e666aed4ec481bb7729c47c7e3a961'
AND (
token = 'P9m+IZ9rgviK2/OJimjZ7421tlJICcjlzmDMXdAwM1Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)