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