UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3Tj9A+TaaCWEFE9gHWU/fLA7F0UdxnKer7f36iw1Q8k='
WHERE
key_id = 'b9ab53ec225cd0c89dde3ed0894bbb9b18da7d64415b0fc6b5ec08d48aa96435'
AND (
token = '3Tj9A+TaaCWEFE9gHWU/fLA7F0UdxnKer7f36iw1Q8k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)