UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hBRE08VALmglkK6NIFjWYd4MqDprADwZFcI9x8cVEAs='
WHERE
key_id = 'dd7e790919872bf7a95f5869cdbe0bb1db0dea3b23a28c2c3157cdf842bf0de5'
AND (
token = 'hBRE08VALmglkK6NIFjWYd4MqDprADwZFcI9x8cVEAs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)