UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8UpwOWAtARSnl0cG7GNYHOanDRQuZSCTTgMeKiWQcvI='
WHERE
key_id = '4a32b170430e171d5af37370d235ca14307d38b07a5b49256baeab3914003baf'
AND (
token = '8UpwOWAtARSnl0cG7GNYHOanDRQuZSCTTgMeKiWQcvI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)