UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XhKTeWfKKWbYSzwroD6FAaLO/NioWGidVyQ73KZmFxU='
WHERE
key_id = 'e5b5e90609e62ecf9600c6be40ebfc890876223a4ab9f20d6436412bb037a2d5'
AND (
token = 'XhKTeWfKKWbYSzwroD6FAaLO/NioWGidVyQ73KZmFxU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)