UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+Lyg7SxncoMtci6/regN6uB0iGTf9H/cnX2GORHXMz4='
WHERE
key_id = 'ae387bac66a579f92aae1c6647401b4551b9d6b6844a09d6d991b95fcc57ffe6'
AND (
token = '+Lyg7SxncoMtci6/regN6uB0iGTf9H/cnX2GORHXMz4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)