UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cG/jPg0l7SmXO8dTK5hxwtmltefjXdNwYMfGuh6xAGk='
WHERE
key_id = '7af670c97e3cb1fedb45eced973e32d4bbc57813b9fed2b38ba2377ed2b08ba7'
AND (
token = 'cG/jPg0l7SmXO8dTK5hxwtmltefjXdNwYMfGuh6xAGk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)