UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HmT2A8iVPpd1afp0adSrJsl7V/9FmcfDvzkGNHzcHqs='
WHERE
key_id = '58b396cc80ffd1c9d3fa5bba70e976e9c9b0dda5a84f478c9c94db6dab1c5e00'
AND (
token = 'HmT2A8iVPpd1afp0adSrJsl7V/9FmcfDvzkGNHzcHqs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)