UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EJ1nfUQ8p05tGl0Hgm8o/ot2iVjU7lBB+iCjYG8HCss='
WHERE
key_id = 'e3fe9d57f54de50587ce3843341fe113dcc5c88063c938c563c8b23465f00ad6'
AND (
token = 'EJ1nfUQ8p05tGl0Hgm8o/ot2iVjU7lBB+iCjYG8HCss='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)