UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5SMmhn5qGnwkvPvFyiLObgkEfCJnM8fLOQHcx255yeg='
WHERE
key_id = '8d2596f6a40408946575ef53acadcc946f757c6e992872d538bab09c55e88245'
AND (
token = '5SMmhn5qGnwkvPvFyiLObgkEfCJnM8fLOQHcx255yeg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)