UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wpdYcGzaaAb9T4A8jHFSnQvVhR8KRcFCkFX+gbp+3yE='
WHERE
key_id = 'a12d75b06416cc5caca30d7cee51e9c78e927940d6e9be153b32b8f08626946a'
AND (
token = 'wpdYcGzaaAb9T4A8jHFSnQvVhR8KRcFCkFX+gbp+3yE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)