UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eCp1lJq/rJpSXtuYxEVgtRRL8siyAlXMH60f3wHWoL0='
WHERE
key_id = '8849dc94ab220674f051e1e4e2365199ead66ccd2250d90361613d60c00551a7'
AND (
token = 'eCp1lJq/rJpSXtuYxEVgtRRL8siyAlXMH60f3wHWoL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)